#include <iostream>
#include <queue>

using namespace std;

int main() {
	
	priority_queue<int,vector<int>,greater<int>> q;
	int n,k;
	cin>>n>>k;
	int nSum=0;
	for(int i=0;i<n;++i){
		int t;
		cin>>t;
		q.push(t);
	}
	int nCnt=0;
	while(nSum+q.top()<=k){
		++nCnt;
		int u=q.top();
		nSum+=u;
		q.pop();
		q.push(u*2);
	}
	cout<<nCnt<<endl;
	
	return 0;
}
